package com.dxx.cloud.admin.controller.admin;


import com.dxx.cloud.admin.module.entity.SysConfigEntity;
import com.dxx.cloud.admin.service.ISysConfigService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.dromara.common.core.domain.R;
import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sysConfig")
@Tag(name = "配置模块")
public class SysConfigController {

    @Resource
    private ISysConfigService sysConfigService;

    @PostMapping("/getValue")
    public R<String> getValue(@RequestBody @Validated SysConfigEntity request) {
        Assert.hasText(request.getType(),"type不能为空");
        Assert.hasText(request.getName(),"name不能为空");
        return R.ok(sysConfigService.getValue(request.getType(),request.getName()));
    }
}
